This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 219
Account for products without variations in the On Sale Products block #5470
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ralucaStan
added
type: bug
The issue/PR concerns a confirmed bug.
block: best selling products
Issues related to the Best Selling Products block.
block: on sale products
Issues related to the On Sale Products block.
labels
Dec 29, 2021
Size Change: +48 B (0%) Total Size: 819 kB
ℹ️ View Unchanged
|
mikejolley
suggested changes
Dec 29, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. I think we just need to tweak it slightly so we return earlier.
Co-authored-by: Mike Jolley <[email protected]>
@mikejolley changes have been addressed. |
mikejolley
reviewed
Dec 30, 2021
@@ -361,14 +361,19 @@ protected function prime_product_variations( $product_ids ) { | |||
$product_variations = $wpdb->get_results( "SELECT ID as variation_id, post_parent as product_id from {$wpdb->posts} WHERE post_parent IN ( " . implode( ',', $prime_product_ids ) . ' )', ARRAY_A ); | |||
$prime_variation_ids = array_column( $product_variations, 'variation_id' ); | |||
$variation_ids_by_parent = array_column( $product_variations, 'product_id', 'variation_id' ); | |||
$all_variation_meta_data = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason for this line? It's unused as far as I can see.
mikejolley
approved these changes
Dec 30, 2021
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
block: best selling products
Issues related to the Best Selling Products block.
block: on sale products
Issues related to the On Sale Products block.
type: bug
The issue/PR concerns a confirmed bug.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR accounts for the case when no product variations are present in the blocks that use the
prime_product_variations
functionFixes #5417
Testing
Manual Testing
How to test the changes in this Pull Request:
On a store with no products store
Changelog